home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
man
/
oldman3
/
Range.3T
< prev
next >
Wrap
Text File
|
1992-06-26
|
3KB
|
89 lines
.TH RANGE
.SH NAME
Range
<Type,lbound,hbound>
A parameterized range
.SH SYNOPSIS
#include <cool/Range.h>
.SH DESCRIPTION
The \f3Range<Type,lbound,hbound>\f1 class is publicly derived from the
Range
class
and supports user-defined ranges for a type of object or built-in data type.
This allows other higher level data structures such as the
Rational
and
Complex
classes to be restricted to a range of values. The programmer does not have to
add bounds-checking code to the application. A vector of positive integers, for
example, would be easy to declare, facilitating bounds checking restricted to
the code that implements the type, not the vector.
.PP
The inclusive low and high bounds for the range are specified as arguments to
the parameterized type declaration and implementation macro calls. They are
declared as \f3C++\f1 constants of the appropriate type. No storage is allocated, and
all references are compiled out by the compiler. Once declared, a
\f3Range<Type,lbound,hbound>\f1 object cannot have its upper or lower bounds changed
because maintenance of all instances would require significant and unwarranted
overhead.
.SH Base Classes
Range
.SH Friend Classes
None
.SH Constructors
.TP
\f3Range<Type,lbound,hbound> ();\f1
Creates an empty range object of the specified type and ranges.
.TP
\f3Range<Type,lbound,hbound> (const Type& \f2value\f3);\f1
Creates a range object with the specified value. If
value
is outside of the
lower and upper bounds, an \f3\f3Error\f1\f1 exception is raised.
.TP
\f3Range<Type,lbound,hbound> (const Range<Type,lbound,hbound>& \f2r\f3);\f1
Creates a new range object with the same value as the range object \f2r\f1.
.SH Member Functions
.TP
inline const Type& high () const;
Returns a reference to the upper limit of the range.
.TP
inline const Type& low () const;
Returns a reference to the lower limit of the range.
.TP
\f3inline Range<Type,lbound,hbound>& operator= (const Range<Type,lbound,hbound>& \f2r\f3);\f1
Overloads the assignment operator for the \f3Range<Type,lbound,hbound>\f1 class and
assigns the range object the value of \f2r\f1. This function returns a reference to the updated object.
.TP
\f3inline void set (const Type& \f2value\f3);\f1
Sets the value of the range object to
value
if within the lower and upper
limits; otherwise, this function raises an
\f3\f3Error\f1\f1
exception.
.TP
\f3inline void set_compare (Range_Compare \f2r_fcn\f3);\f1
Sets the compare function for this class of \f3Range<Type,lbound,hbound>\f1.
Range_Compare
is a function of type
int
(\f2*Function\f1)
\f3(const Type&\f1, \f3const Type&\f1).
.TP
inline operator Type () const;
Overloads the implicit conversion operator for the parameterized type to
facilitate mixed-type expressions and statements.
.SH COPYRIGHT
Copyright (C) 1991 Texas Instruments Incorporated.
Permission is granted to any individual or institution to use, copy, modify,
and distribute this software, provided that this complete copyright and
permission notice is maintained, intact, in all copies and supporting
documentation.
Texas Instruments Incorporated provides this software "as is" without
express or implied warranty.